package routers

import (
	"stacks/config"
	"stacks/controllers"

	"github.com/gin-gonic/gin"
)

// ProtectedRoutes 受保护路由管理器
type ProtectedRoutes struct {
	authController       *controllers.AuthController
	tentantController    *controllers.TenantController
	userController       *controllers.UserController
	roleController       *controllers.RoleController
	permissionController *controllers.PermissionController
	menuController       *controllers.MenuController
}

// NewProtectedRoutes 创建受保护路由管理器实例
func NewProtectedRoutes(cfg *config.Config) *ProtectedRoutes {
	return &ProtectedRoutes{
		authController:       controllers.NewAuthController(cfg),
		tentantController:    controllers.NewTenantController(),
		userController:       controllers.NewUserController(),
		roleController:       controllers.NewRoleController(),
		permissionController: controllers.NewPermissionController(),
		menuController:       controllers.NewMenuController(),
	}
}

// RegisterAll 注册所有受保护路由
func (pr *ProtectedRoutes) RegisterAll(protected *gin.RouterGroup) {
	pr.RegisterUserRoutes(protected)
	pr.RegisterRoleRoutes(protected)
	pr.RegisterPermissionRoutes(protected)
	pr.RegisterMenuRoutes(protected)
}
